<?php

class blocks extends MX_Controller
{
    public function blocks()
    {
        parent::__construct();
    }
    
    public function header()
    {
        return $this->load->view('blocks/header', array());
    }
    
    public function chuyende()
    {
        $this->load->model('Skill_Categories_Model');
        $skillModel = new Skill_Categories_Model();
        $data = $skillModel->frontTop();
        
        $arr = array();
        foreach ($data as $row) {
            $arr[$row->id][] = $row;
        }
        
        return $this->load->view('blocks/chuyende', array('data' => $arr));
    }
    
    public function soft_skill()
    {
        $this->load->model('Skill_Categories_Model');
        $skillModel = new Skill_Categories_Model();
        $data = $skillModel->getCategory_ByMenu(1, 0, 10);
        return $this->load->view('blocks/soft_skill', array('data' => $data));
    }
    
    
    public function english_skill()
    {
        $this->load->model('Skill_Categories_Model');
        $skillModel = new Skill_Categories_Model();
        $data = $skillModel->getCategory_ByMenu(2, 0, 10);
        return $this->load->view('blocks/english_skill', array('data' => $data));
    }
    
    public function banner_body()
    {
        return $this->load->view('blocks/banner_body', array());
    }
    
    public function video_skill()
    {
        $this->load->model('Skill_Videos_Model');
        $skillModel = new Skill_Videos_Model();
        $data = $skillModel->getVideo_ByMenu(1, 0, 4, 2);
        $topHit = $skillModel->getVideo_ByMenu(1, 0, 5, 1);
        return $this->load->view('blocks/video_skill', array('data' => $data, 'tophit' => $topHit));
    }
    
    public function video_english()
    {
        $this->load->model('Skill_Videos_Model');
        $skillModel = new Skill_Videos_Model();
        $data = $skillModel->getVideo_ByMenu(2, 0, 4, 2);
        $topHit = $skillModel->getVideo_ByMenu(2, 0, 5, 1);
        return $this->load->view('blocks/video_english', array('data' => $data, 'tophit' => $topHit));
    }
    
    public function right_top_banner()
    {
        return $this->load->view('blocks/right_top_banner', array());
    }
    
    public function right_bot_banner()
    {
        return $this->load->view('blocks/right_bot_banner', array());
    }
    
    public function courses()
    {
        $this->load->model('Skill_Categories_Model');
        $skillModel = new Skill_Categories_Model();
        $dataSoft = $skillModel->blockCoursesSoft();
        $dataEnglish = $skillModel->blockCoursesEnglish();
        return $this->load->view('blocks/courses', array('soft' => $dataSoft, 'english' => $dataEnglish));
    }
    
    public function footer()
    {
        $this->load->model('pages_model');
        $pagemodel = new Pages_Model();
        $data = $pagemodel->getPagesById(1);
        if ($data) {
            $content = $data->contents;
        } else {
            $content = '';
        }
        return $this->load->view('blocks/footer', array('content' => $content));
    }
    
}